package com.prs.crm.domain.store;
/**
 * @author 兰小刚
 * @version 
 * 类说明
 */
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.FlowCodeEntity;

/**
 * 入库单
 * 
 * @author Administrator
 * 
 */
@Entity
@Table(name = "stock_storein")
public class StoreIn extends FlowCodeEntity {
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	/**
	 * 入库编码
	 */
	private  String  storeInCode;
	/**
	 * 入库主题
	 */
	private String titlename;
	/**
	 * 仓库
	 */
	@ManyToOne
	private StoreRoom room;

	/**
	 * 入库日期
	 */
	private Date storagedata;

	/**
	 * 入库明细
	 */
	@OneToMany(mappedBy = "storein")
	@Cascade( { org.hibernate.annotations.CascadeType.ALL,
			org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Set<StoreInDetail> details;
	/**
	 * 入库概要
	 */
	@Lob
	private String remark;
	
	/**
	 * 批号
	 */
	private String batchNum;
	/**
	 * 
	 * 入库的订单id
	 */
	@Column(columnDefinition = "Integer(11) default '0'")
	private int purchaseOrderId;
	/**
	 * 
	 * 入库的销售退货
	 */
	@Column(columnDefinition = "Integer(11) default '0'")
	private int saleContractId;
	
	


	public int getPurchaseOrderId() {
		return purchaseOrderId;
	}

	public void setPurchaseOrderId(int purchaseOrderId) {
		this.purchaseOrderId = purchaseOrderId;
	}

	public int getSaleContractId() {
		return saleContractId;
	}

	public void setSaleContractId(int saleContractId) {
		this.saleContractId = saleContractId;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTitlename() {
		return titlename;
	}

	public void setTitlename(String titlename) {
		this.titlename = titlename;
	}

	public StoreRoom getRoom() {
		return room;
	}

	public void setRoom(StoreRoom room) {
		this.room = room;
	}

	public Date getStoragedata() {
		return storagedata;
	}

	public void setStoragedata(Date storagedata) {
		this.storagedata = storagedata;
	}

	public Set<StoreInDetail> getDetails() {
		return details;
	}

	public void setDetails(Set<StoreInDetail> details) {
		this.details = details;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public void addDetail(StoreInDetail detail) {
		if (details == null)
			details = new HashSet<StoreInDetail>();
		detail.setStorein(this);
		details.add(detail);
	}

	public String getBatchNum() {
		return batchNum;
	}

	public void setBatchNum(String batchNum) {
		this.batchNum = batchNum;
	}

	public String getStoreInCode() {
		return storeInCode;
	}

	public void setStoreInCode(String storeInCode) {
		this.storeInCode = storeInCode;
	}

}
